package Day12_String类;

public class ZuoYe02 {
    public static void main(String[] args) {
        Teacher t1 = new Teacher();
        t1.setName("张岩");
        t1.setID(9999);
        t1.show();

        Teacher t2 = new Teacher("张研",1234);
        t2.show();
    }
}

class Teacher{
    //成员变量私有化
    private String name;
    private int ID;
    //无参构造
    public Teacher(){

    }
    //有参构造
    public Teacher(String name,int ID){
        this.name = name;
        this.ID = ID;
    }
    //get set方法

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getID() {
        return ID;
    }

    public void setID(int ID) {
        this.ID = ID;
    }
    public void show (){
        System.out.println("工号为"+ID+"的"+name+"老师正在讲课");
    }
}